<%--
  Created by IntelliJ IDEA.
  User: hadoop
  Date: 17-6-12
  Time: 下午8:39
  测试使用bean
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="beans.Person" %>
<html>
<head>
    <title>jsp:useBean</title>
</head>
<body>
<jsp:useBean scope="page" id="p1" class="beans.Person"/>
<jsp:setProperty name="p1" property="name" value="Naruto"/>
<jsp:setProperty name="p1" property="age" value="20"/>
<p>
    来自jsp:useBean:
    <jsp:getProperty name="p1" property="name"/>,&nbsp;
    <jsp:getProperty name="p1" property="age"/>
</p>
<p>
   来自pageContext:
    <%
        p1 = (Person) pageContext.getAttribute("p1");
        out.println(p1.getName()+", "+p1.getAge());
    %>
</p>
</body>
</html>
